cat << EOF > /etc/systemd/system/wapi.service
[Unit]
Description=wangzhuan api server
After=network.target

[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/www/wangzhuanapi
ExecStart=/www/server/java/jdk-17.0.8/bin/java  -Xms256m -Xmx2g -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=1g -XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 -XX:+UseG1GC -Dquarkus.http.port=9995 -Dquarkus.config.locations=file:/www/wangzhuanapi/deploy.properties -jar /www/wangzhuanapi/quarkus-app/quarkus-run.jar
Restart=on-failure
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=wapi
Environment=JAVA_HOME=/www/server/java/jdk-17.0.8

# 安全设置
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ReadWritePaths=/www/wangzhuanapi

[Install]
WantedBy=multi-user.target
EOF